<template>
	<view class="content">
		<image src="../../../static/img/concat.png" class="zqf-image" mode="" @click="preview"></image>
		<view class="button-sp-area margin-top-20">
			<!-- <button class="mini-btn" type="primary" @click="saveImage">点击保存图片</button> -->
		</view>
	</view>
</template>

<script>
	export default{
		methods: {
			saveImage(){
				console.log(6)
				uni.downloadFile({
					url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-unicloud-zqf/abd5c850-a817-11ea-b997-9918a5dda011.png',
					success: (res) =>{
						console.log(res)
						if (res.statusCode === 200){
							uni.saveImageToPhotosAlbum({
								filePath: res.tempFilePath,
								success: function() {
									uni.showToast({
										title: "保存成功",
										icon: "none"
									});
								},
								fail: function() {
									uni.showToast({
										title: "保存失败，请稍后重试",
										icon: "none"
									});
								}
							});
						}
					}
				})
			},
			preview(){
				//只有小程序码才能长按识别
			    uni.previewImage({
			        urls: ['https://vkceyugu.cdn.bspapp.com/VKCEYUGU-unicloud-zqf/abd5c850-a817-11ea-b997-9918a5dda011.png'],//拿vuex中的头像地址
			        longPressActions: {
			            itemList: ['发送给朋友', '保存图片', '收藏', '识别图中二维码'],
			            success: function(data) {
			                console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
			            },
			            fail: function(err) {
			                console.log(err.errMsg);
			            }
			        }
			    });
			}
		}
	}
</script>

<style scoped>
	.content{
		text-align: center;
	}
	.zqf-image{
		width: 640upx;
		height: 640upx;
	}
</style>
